<?php
$product = getRecord("tbl_product", "id=" . $_REQUEST['id']);
?>
<div class="product-listing" itemscope itemtype="http://schema.org/title">
	<div class="title_left_bg" ></div>
    <div class="title_center_bg" itemprop='text'>
        <div class="title_center_icon"></div><? include ("module/processTitle.php") ?>
    </div>
    <div class="title_right_bg"></div>
</div>

<div id="info_product">
	<div id="info_product_left" itemscope itemtype="http://schema.org/Product">
        <? if ($product["image"] == '') { ?>
        <img itemprop='image' title="<?= $product["name"] ?>" src="/khohangtot/images/spm.jpg" width="180" height="160" border="0">
		<? } else { ?>
        <img itemprop='image' title="<?= $product["name"] ?>" src="/khohangtot/images/product/images/<?= $product["image"] ?>" width="180" height="160" border="0">
		<? } ?>
	</div>
	<div id="info_product_right" itemscope itemtype="http://schema.org/Product">
		<p class="product_name" itemprop='name'><?= $product["name"] ?></p>
		<p>Tình trạng: <span class="red"><? if ($product["status1"] == 1) { ?><img title="khohangtot| do gia dung" src="/khohangtot/images/moi.gif" width="29" height="19" /><? } ?></span></p>
        <p itemprop='review'>Lượt xem: <span class="red"><?= $product["luotxem"] ?></span></p>
		<p itemprop='price'  itemscope itemtype="http://schema.org/PriceSpecification">Giá bán: <span class="red" itemprop='price'><?= $product['price'] == 0 ? '<b>Call</b>' :
'<b>' . number_format($product['price'], 0) ?>&nbsp;&nbsp;<?= $currencyUnit ?></span></p>
		<a itemprop='url' title="khohangtot| do gia dung" href="/khohangtot/<?= $_REQUEST["id"] ?>/add-to-cart.htm"><img title="khohangtot| do gia dung" src="/khohangtot/images/dat_mua.jpg" alt="Cho vào giỏ hàng"/></a>
     <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FKho-h%25C3%25A0ng-t%25E1%25BB%2591t-wwwkhohangtotcom%2F487888457990645&amp;width&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe>   
	</div>
    
</div>

<div id="detail_product" itemscope itemtype="http://schema.org/Product">
	<span class="cart_thumb" itemprop='alternateName'>CHI TIẾT SẢN PHẨM</span>
	
	<div id="detail_product_content" itemprop='description'>
		<?= $product["detail"] ?>
	</div>
    <div data-href="https://www.facebook.com/pages/Kho-h%C3%A0ng-t%E1%BB%91t-wwwkhohangtotcom/487888457990645" data-numposts="5" data-colorscheme="light" class="fb-comments fb_iframe_widget" fb-xfbml-state="rendered"><span style="height: 155px; width: 550px;"><iframe id="f2402cbdc" name="f28bda1934" scrolling="no" title="Facebook Social Plugin" class="fb_ltr" src="https://www.facebook.com/plugins/comments.php?api_key=113869198637480&amp;channel_url=https%3A%2F%2Fs-static.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D28%23cb%3Df3080c422%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff1c676cc64%26relation%3Dparent.parent&amp;colorscheme=light&amp;href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FKho-h%25C3%25A0ng-t%25E1%25BB%2591t-wwwkhohangtotcom%2F487888457990645&amp;locale=vi_VN&amp;numposts=5&amp;sdk=joey&amp;skin=light&amp;width=550" style="border: none; overflow: hidden; height: 155px; width: 550px;"></iframe></span></div>
</div>
 <?
$row = 10;
$col = 4;
$parent = $product["parent"];
$cat = 0;
if ($_REQUEST['cat'] != '')
    $cat = killInjection($_REQUEST['cat']);
$ppp = 0;
if ($_REQUEST['ppp'] != '')
    $p = $_REQUEST['ppp'];
$sql = "select id,name,image,price from tbl_product where parent in (select id from tbl_product_category where parent=".$parent." or id =".$parent.")"." and id <>'" . $_REQUEST['id'] .
    "' and status=0 order by price asc limit " .$row *
    $col * $ppp . "," . $row * $col;
$change = array(
    '"',
    "",
    "");
$result = @mysql_query($sql, $conn);
/*$total = countRecord("tbl_product", "id<>'" . $_REQUEST['id'] .
    "' and status=0 and parent ='" . $parent . "'");
if ($total != 0) {*/
?>
 
 <div class="product-listing" itemscope itemtype="http://schema.org/Product">
	<div class="title_left_bg" itemprop='description'></div><div class="title_center_bg" itemprop='name'><div class="title_center_icon"></div>Sản phẩm cùng loại</div><div class="title_right_bg"></div>
    <ul class="clearfix" itemprop='description'>
        <?
    for ($i = 0; $i < $row; $i++) {
        for ($j = 0; $j < $col && $products = mysql_fetch_assoc($result); $j++) {
            $pro = getRecord("tbl_product", "id=" . $products['id']);
            $ro = getRecord("tbl_product_category", "id=" . $pro['parent']);
            $strLinkFriendly = unicodeToNonUnicode($pro["name"]);
?>
        
		<li class="product" itemprop='description'>
            <div class="product-item" itemprop='description'>
                <div class="name_thumb" itemprop='description'>
                	<a itemprop='url' title="<?=$pro["name"]?>" href="/khohangtot/product-detail/<?= $pro['id'] ?>/<?=$strLinkFriendly?>.htm" class="title"><?= substr($pro["name"],
    0, 40) ?>..</a>
                    <img itemprop='image' title="<?=$pro["name"]?>" src="/khohangtot/images/icon_hot_png.gif"/>
                </div><!--end .name_thumb-->
                <a itemprop='url' title="<?=$pro["name"]?>" href="/khohangtot/product-detail/<?= $pro['id'] ?>/<?=$strLinkFriendly?>.htm" class="thumb">
                <? if ($pro["image"] == '') { ?>
                    <img itemprop='logo' title="<?=$pro["name"]?>" src="/khohangtot/images/spm.jpg" width="140" height="140" border="0" />
                <? } else { ?>
                    <img itemprop='logo' title="<?=$pro["name"]?>" src="/khohangtot/images/product/images/<?= $pro["image"] ?>" width="140" height="140" border="0" />
                <? } ?>
                </a>
                <span itemprop='description'>Giá bán: </span><span class="price" itemprop='price'>&nbsp<?= number_format($pro['price'],
    0) ?> 
                            &nbsp;<?= $currencyUnit ?></span>
                <a itemprop='url' title="khohangtot| do gia dung" href="/khohangtot/<?= $pro['id'] ?>/add-to-cart.htm">
                <img itemprop='logo' title="khohangtot| do gia dung" src="/khohangtot/images/chonsp.png" class="add-to-cart"/></a>
            </div>
        </li>
        <? }
    } ?>
    </ul><!--end .clearfix-->
</div><!--end .product-listing-->
<? //} ?>
<? 

$luotxem=$product["luotxem"]+1;

$s="update tbl_product set luotxem='".$luotxem."' where id='".$_REQUEST["id"]."'";

$r=mysql_query($s,$conn);

?>
